<template>
  <a-card>
    <a-modal
      title="挂号结算"
      :width="800"
      :visible="modalMisible"
      :plain="true"
      @ok="submitOk"
      @cancel="modalMisible=false"
    >
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="挂号单ID"  hasFeedback>
          {{record.id}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="微信openid"  hasFeedback>
          {{record.openid}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="挂号费用" hasFeedback>
          ￥{{record.registerPrice}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="挂号渠道" hasFeedback>
          {{record.hospitalName}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="渠道比例" hasFeedback>
          {{record.hospitalShare}} %
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="渠道应收" hasFeedback>
          ￥{{record.hospitalProfit}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="医生姓名" hasFeedback>
          {{record.doctorName}}
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="医生比例" hasFeedback>
          {{record.registerRatio}} %
        </a-form-item>
      </a-form>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="医生应收" hasFeedback>
          ￥{{record.doctorProfit}}
        </a-form-item>
      </a-form>
    </a-modal>

  </a-card>
</template>

<script>
  import { httpAction, getAction,putAction } from '@api/manage'
  import JDate from '@/components/jeecg/JDate'
  export default {
    name: 'DoctorRegisterRecordSettle',
    components: {
      JDate,
    },
    inject: ['reload'],

    data() {
      return {
        title: '挂号管理',
        modalMisible: false,
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        labelCols: {
          xs: { span: 12 },
          sm: { span: 8 },
        },
        wrapperCols: {
          xs: { span: 12 },
          sm: { span: 10 },
        },
        record:{},
        // departments:{},//可是信息
        form: this.$form.createForm(this),
        validatorRules: {
          share: {
            rules: [
              { required: true, message: '请输入数字值' },
            ]
          },
        },

        url: {
          settle: "/doctorRegisterRecord/doctorRegisterRecord/settle",
          settleDo: "/doctorRegisterRecord/doctorRegisterRecord/settleDo"
        },
      }
    },
    created() {
      this.viewShow();
    },
    methods: {
      viewShow(record) {
        console.log(record.id);
        let attr = {};
        attr.recordId = record.id;
        getAction(this.url.settle, attr).then((res)=>{
          if(res.code === 200){
            this.record = res.result
          }else{
            this.$message.warning(res.message)
          }
        }).catch((error)=>{
          console.log(error);
        })
        this.modalMisible = true
      },

      submitOk () {
        let attr = {};
        attr.recordId = this.record.id;
        getAction(this.url.settleDo, attr).then((res)=>{
          console.log(res);
          if(res.code === 200){
            this.$message.success(res.message)
          }else{
            this.$message.warning(res.message)
          }
          this.reload()
        }).catch((error)=>{
          console.log(error);
        })
      },
    }
  }
</script>

<style lang="less" scoped>
  .ant-input-number {
    margin-right: 20px;
    width: 360px;
  }
</style>